import Scene from "./Scene";

export default class App extends Laya.Sprite{

    onAwake(){
    }

    runScene(scene:Scene) {
        let old = this.getChildByName('scene');

        while (old) {
            if ( old['_destroy'] ) {
                old['_destroy']();
            }
            old.destroy(true);
            this.removeChild(old);
            old = this.getChildByName('scene');
        }

        scene.sceneName = typeof scene;
        scene.launch();
        this.addChild(scene);

        return scene;
    }


}